package com.hhb.dao.impl;

import com.hhb.dao.UserDao;
import com.hhb.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class UserDaoImpl implements UserDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void addUser(User user) {

        String sql = "insert into user (id,username,password,age) values(?,?,?,?)";
        int update = jdbcTemplate.update(sql, user.getId(), user.getUsername(), user.getPassword(), user.getAge());
        System.out.println(update);

    }
}
